<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对日期字符串化</title>
</head>

<body>
    <h1>JSON.stringify 会把任何日期对象转换为字符串</h1>
    <p id="demo"></p>
    <script>
        var obj = { name: "Bill Gates", today: new Date(), city: "Seattle" };
        var myJSON = JSON.stringify(obj);
        document.getElementById("demo").innerHTML = myJSON;
    </script>
</body>

</html>